var Adv_skd=require("./Adv_skd")

var cc__decorate = __decorate;
Object.defineProperty(exports, "__esModule", {
  value: true
});
var $2Hts = require("Hts");
var $2ADManager = require("ADManager");
var $2AudioManager = require("AudioManager");
var $2BundleManager = require("BundleManager");
var $2DataManager = require("DataManager");
var $2ExcelManager = require("ExcelManager");
var $2PlantMgr = require("PlantMgr");
var $2UIManager = require("UIManager");
var $2UserDataManager = require("UserDataManager");
var $2TaSdk = require("TaSdk");
var $2KDefine = require("KDefine");
var $2FlbDataStorageUtil = require("FlbDataStorageUtil");
var $2pvzChannel = require("pvzChannel");
var $2pvzChannelTT = require("pvzChannelTT");
var cc__decorator = cc._decorator;
var ccp_ccclass = cc__decorator.ccclass;
var ccp_property = cc__decorator.property;
var def_MenuUI = /* */function (_cc$Component47) {
  babel_inherits(b, _cc$Component47);
  var _super51 = babel_createSuper(b);
  function b() {
    var _this108;
    babel_classCallCheck(this, b);
    _this108 = _super51.apply(this, arguments);
    _this108.moreGame = null;
    _this108.bt_jsdx_buy = null;
    _this108.is_app = false;
    _this108.guideString = ["点击这里进入关卡", "点击这里来抽奖吧", "点击这里可以进行boss挑战，现在实力还不够哦，获得更多强力植物再来挑战吧！"];
    _this108.bg1spf = null;
    return _this108;
  }
  babel_createClass(b, [{
    key: "onLoad",
    value: function onLoad() {
 Adv_skd.default.instance.hideAllAdv();
        Adv_skd.default.instance.showInterstitialAd();
        Adv_skd.default.instance.showGridAdRightOne();
        
      var _this109 = this;
      this.gdyx = cc.find("gdyx", this.node);
      this.setting = cc.find("setting", this.node);
      if ($2pvzChannel.pvzChannel.instance().channel.indexOf("wx") >= 0 || "web" === $2pvzChannel.pvzChannel.instance().channel) {
        this.gdyx.active = true;
        this.gdyx.on(cc.Node.EventType.TOUCH_END, this.on_gdyx, this);
      } else {
        this.gdyx.active = false;
      }
      this.setting.on(cc.Node.EventType.TOUCH_END, this.on_setting, this);
      this.is_app = false;
      this.moreGame.on(cc.Node.EventType.TOUCH_END, function () {
        $2pvzChannel.pvzChannel.instance().showMoreGameBox(_this109.node, cc.v2(0, 0), true);
      }, this);
      this.bt_jsdx_buy.active = $2pvzChannel.pvzChannel.instance().isShowJsdxBuy();
      this.bt_jsdx_buy.on(cc.Node.EventType.TOUCH_END, function () {
        $2pvzChannel.pvzChannel.instance().showJsdxBuy(_this109.node);
      }, this);
      if ($2pvzChannel.pvzChannel.instance().canMoreGame()) {
        $2pvzChannel.pvzChannel.instance().showMoreGameBox(this.node, cc.v2(0, 0), false);
        this.moreGame.active = true;
      } else {
        this.moreGame.active = false;
      }
      $2pvzChannel.pvzChannel.instance().apiReport($2pvzChannelTT.pvzChannelTT.API_EventType.active_register);
      cc.tween(this.gdyx).repeatForever(cc.tween().to(.8, {
        scale: 1
      }).to(.8, {
        scale: .8
      })).start();
      cc.dynamicAtlasManager.reset();
      this.registerEvent();
      $2AudioManager.default.instance.playMusic($2KDefine.AudioName.MenuBgm, true);
      $2DataManager.default.instance.clearTempData();
      this.bg1spf || (this.bg1spf = $2BundleManager.default.instance.getBundleRes("BundleTexture", "MenuUI/Bg1", cc.SpriteFrame));
      cc.find("Canvas/Bg").getComponent(cc.Sprite).spriteFrame = this.bg1spf;
      cc.find("Canvas/Bg").x = 0;
      $2UIManager.default.instance.showUI("MoneyPanelUI", 30);
      this.guidePanel = this.node.getChildByName("GuidePanel");
      this.guidePanel.zIndex = 90;
      this.bg1 = this.node.getChildByName("BgPanel").getChildByName("Bg1");
      this.bg2 = this.node.getChildByName("BgPanel").getChildByName("Bg2");
      this.bg3 = this.node.getChildByName("BgPanel").getChildByName("Bg3");
      this.bg2.on(cc.Node.EventType.TOUCH_MOVE, this.bg2Move, this);
      this.effectPanel = this.bg1.getChildByName("EffectPanel");
      this.btnPanel = this.bg1.getChildByName("BtnPanel");
      this.playAnimation();
      this.initBtnPanel();
      this.showNode();
      $2UserDataManager.default.instance.newUser && ($2UserDataManager.default.instance.newUser = false);
      if ($2DataManager.default.instance.focus) {
        if ($2UserDataManager.default.instance.level > 2) {
          if ($2UserDataManager.default.instance.level > 3) {
            this.bg1.x -= this.btnPanel.children[$2UserDataManager.default.instance.level - 2].x;
            this.bg2.x = (this.bg1.x + 667.5) / 2 - 667.5;
            this.bg3.x = (this.bg1.x + 667.5) / 4 - 667.5;
          }
          cc.tween(this.bg1).delay(.5).by(1, {
            x: -(this.btnPanel.children[$2UserDataManager.default.instance.level - 1].x - this.btnPanel.children[$2UserDataManager.default.instance.level - 2].x)
          }).call(function () {
            $2DataManager.default.instance.focus = false;
            _this109.btnPanel.children[$2UserDataManager.default.instance.level - 1].getChildByName("Bg").getComponent(cc.Sprite).spriteFrame = $2BundleManager.default.instance.getBundleRes("BundleTexture", "MenuUI/z002", cc.SpriteFrame);
            var e = cc.instantiate($2BundleManager.default.instance.getBundleRes("Prefab", "Object/BtnEffect"));
            _this109.btnPanel.children[$2UserDataManager.default.instance.level - 1].addChild(e);
            e.getComponentInChildren(sp.Skeleton).setAnimation(0, "FX", false);
            e.getComponentInChildren(sp.Skeleton).setCompleteListener(function () {
              e.getComponentInChildren(sp.Skeleton).setCompleteListener(null);
              e.getComponentInChildren(sp.Skeleton).setAnimation(0, "FX1", true);
            });
          }).start();
          cc.tween(this.bg2).delay(.5).by(1, {
            x: -(this.btnPanel.children[$2UserDataManager.default.instance.level - 1].x - this.btnPanel.children[$2UserDataManager.default.instance.level - 2].x)
          }).start();
          cc.tween(this.bg3).delay(.5).by(1, {
            x: -(this.btnPanel.children[$2UserDataManager.default.instance.level - 1].x - this.btnPanel.children[$2UserDataManager.default.instance.level - 2].x)
          }).start();
        } else {
          $2DataManager.default.instance.focus = false;
          this.btnPanel.children[$2UserDataManager.default.instance.level - 1].getChildByName("Bg").getComponent(cc.Sprite).spriteFrame = $2BundleManager.default.instance.getBundleRes("BundleTexture", "MenuUI/z002", cc.SpriteFrame);
          var _e52 = cc.instantiate($2BundleManager.default.instance.getBundleRes("Prefab", "Object/BtnEffect"));
          this.btnPanel.children[$2UserDataManager.default.instance.level - 1].addChild(_e52);
          _e52.getComponentInChildren(sp.Skeleton).setAnimation(0, "FX", false);
          _e52.getComponentInChildren(sp.Skeleton).setCompleteListener(function () {
            _e52.getComponentInChildren(sp.Skeleton).setCompleteListener(null);
            _e52.getComponentInChildren(sp.Skeleton).setAnimation(0, "FX1", true);
          });
        }
      } else {
        this.initBg();
      }
      if (0 != $2DataManager.default.instance.lockPlant) {
        $2UIManager.default.instance.openUI("UnLockPlantUI");
        $2pvzChannel.pvzChannel.instance().closeNative("nativeIcon");
      } else if (!$2UserDataManager.default.instance.upGradeGuide) {
        $2UIManager.default.instance.openUI("GuideUI2", 99).emit("init", 2), $2pvzChannel.pvzChannel.instance().closeNative("nativeIcon");
      }
      if ($2DataManager.default.instance.newChapter) {
        this.newChapter();
      } else {
        this.node.getChildByName("Title").getComponent(cc.RichText).string = "<color=#FFBD00>距离第</color><color=#FFFFFF><b><size=50> ".concat($2UserDataManager.default.instance.chapter + 1, " </size></b></color><color=#FFBD00>天还有</color><color=#FFFFFF><b><size=50> ").concat(21 - $2UserDataManager.default.instance.level, " </size></b></color><color=#FFBD00>关</color>");
      }
      if ($2DataManager.default.instance.drawGuide) {
        $2UIManager.default.instance.openUI("GuideUI2", 99).emit("init", 4);
        $2pvzChannel.pvzChannel.instance().closeNative("nativeIcon");
      }
      $2UserDataManager.default.instance.bossGuide || $2ADManager.default.instance.isTest || (this.node.getChildByName("BtnPanel").getChildByName("BossBtn").active = false);
      $2DataManager.default.instance.bossGuide && this.bossGuide();
      this.initPlatform();
      this.schedule(function () {
        _this109.refreshOnlineBtn();
      }, 1);
    }
  }, {
    key: "on_mnyx",
    value: function on_mnyx() {
      var _this110 = this;
      cc.assetManager.loadBundle("Dfbwzh", function (e, t) {
        if (e) {
          console.error("Dfbwzh加载失败", e);
        } else {
          t.load("DfbwzhUI", cc.Prefab, function (e, t) {
            if (e) {
              console.error("DfbwzhUI加载失败", e);
            } else {
              cc.instantiate(t).parent = _this110.node;
            }
          });
        }
      });
    }
  }, {
    key: "on_setting",
    value: function on_setting() {
      $2UIManager.default.instance.showUI("Pause1UI");
    }
  }, {
    key: "on_gdyx",
    value: function on_gdyx() {
      $2UIManager.default.instance.showUI("MinGamesUI", cc.macro.MAX_ZINDEX);
      $2pvzChannel.pvzChannel.instance().closeNative("nativeIcon");
    }
  }, {
    key: "on_fxlb",
    value: function on_fxlb() {}
  }, {
    key: "on_dfbwz",
    value: function on_dfbwz() {
      var _this111 = this;
      if ($2FlbDataStorageUtil.DataStorageUtil.getVal("dfbwz", false)) {
        $2UIManager.default.instance.showUI("DfbwzhUI");
      } else {
        $2pvzChannel.pvzChannel.instance().showVideo({
          sucCall() {
            _this111.getreward2();
          },
          failCall() {},
          endCall() {}
        });
      }
    }
  }, {
    key: "on_chflb",
    value: function on_chflb() {
      $2UIManager.default.instance.openUI("ChflbUI", 20);
      this.node.opacity = 0;
      $2TaSdk.default.instance.AdsButtonClick($2TaSdk.VideoIndex.chflb);
      $2pvzChannel.pvzChannel.instance().closeNative("nativeIcon");
    }
  }, {
    key: "on_zuqiu",
    value: function on_zuqiu() {
      $2UIManager.default.instance.openUI("JssjbhcUI", 20);
      $2pvzChannel.pvzChannel.instance().closeNative("nativeIcon");
      $2UIManager.default.instance.closeUI("menuUI");
      $2TaSdk.default.instance.AdsButtonClick($2TaSdk.VideoIndex.JssjbhcUI);
    }
  }, {
    key: "getreward2",
    value: function getreward2() {
      $2FlbDataStorageUtil.DataStorageUtil.setVal("dfbwz", true);
      this.n111.setPosition(this.video2.position);
      this.video2.active = false;
      $2UIManager.default.instance.showUI("DfbwzhUI");
      $2UIManager.default.instance.closeUI("menuUI");
    }
  }, {
    key: "registerEvent",
    value: function registerEvent() {
      this.node.on("onClickUpgradeBtn", this.onClickUpgradeBtn, this);
      this.node.on("onClickDrawBtn", this.onClickDrawBtn, this);
    }
  }, {
    key: "bossGuide",
    value: function bossGuide() {
      var e = cc.instantiate($2BundleManager.default.instance.getBundleRes("Prefab", "Object/GuideFinger", cc.Prefab));
      this.node.getChildByName("BtnPanel").getChildByName("BossBtn").active = true;
      this.node.getChildByName("BtnPanel").getChildByName("BossBtn").addChild(e);
      e.x = 0;
      e.y = 13;
      this.guideToast(this.guideString[2]);
    }
  }, {
    key: "newChapter",
    value: function newChapter() {
      var _this112 = this;
      $2DataManager.default.instance.newChapter = false;
      this.node.getChildByName("Cloud").active = true;
      this.node.getChildByName("Cloud").getComponent(cc.Animation).play();
      this.node.getChildByName("Title").getComponent(cc.RichText).string = "<color=#FFBD00>距离第</color><color=#FFFFFF><b><size=50> ".concat($2UserDataManager.default.instance.chapter + 1, " </size></b></color><color=#FFBD00>天还有</color><color=#FFFFFF><b><size=50>1 </size></b></color><color=#FFBD00>关</color>");
      $2UserDataManager.default.instance.level = 1;
      $2UserDataManager.default.instance.chapter++;
      this.scheduleOnce(function () {
        _this112.initBtnPanel();
        _this112.bg1.x = -667.5;
        _this112.bg2.x = -667.5;
        _this112.bg3.x = -667.5;
      }, .8);
      this.node.getChildByName("Cloud").getComponent(cc.Animation).on("stop", function () {
        _this112.node.getChildByName("Title").getComponent(cc.RichText).string = "<color=#FFBD00>距离第</color><color=#FFFFFF><b><size=50> ".concat($2UserDataManager.default.instance.chapter + 1, " </size></b></color><color=#FFBD00>天还有</color><color=#FFFFFF><b><size=50> ").concat(21 - $2UserDataManager.default.instance.level, " </size></b></color><color=#FFBD00>关</color>");
      });
    }
  }, {
    key: "showNode",
    value: function showNode() {
      this.node.opacity = 255;
      this.refreshSignBtn();
      this.refreshUpgradeBtn();
      this.refreshOnlineBtn();
      this.refreshTaskBtn();
      if (!$2UserDataManager.default.instance.levelGuide && $2UserDataManager.default.instance.upGradeGuide) {
        $2UIManager.default.instance.openUI("GuideUI2", 99).emit("init", 3);
        $2pvzChannel.pvzChannel.instance().closeNative("nativeIcon");
      } else if ($2UserDataManager.default.instance.drawGuide && !$2UserDataManager.default.instance.upGradeGuide2) {
        $2UIManager.default.instance.openUI("GuideUI2", 99).emit("init", 5);
        $2pvzChannel.pvzChannel.instance().closeNative("nativeIcon");
      } else {
        $2pvzChannel.pvzChannel.instance().channel.indexOf("wx") >= 0 && $2pvzChannel.pvzChannel.instance().showNative(null, null, "nativeIcon");
      }
      if ($2UserDataManager.default.instance.upGradeGuide2 && !$2DataManager.default.instance.signNote && 0 == $2UserDataManager.default.instance.signTimes) {
        $2DataManager.default.instance.signNote = true;
        this.onClickSignBtn();
      }
    }
  }, {
    key: "refreshTaskBtn",
    value: function refreshTaskBtn() {
      for (var _e53 = 0; _e53 < $2UserDataManager.default.instance.taskInfo.length; _e53++) {
        if ($2UserDataManager.default.instance.taskInfo[_e53].progress >= $2ExcelManager.ExcelMgr.instance.GetExcelObject($2ExcelManager.TableName.taskTable)[$2UserDataManager.default.instance.taskInfo[_e53].id].aim && !$2UserDataManager.default.instance.taskInfo[_e53].finish) {
          return void (this.node.getChildByName("BtnPanel").getChildByName("TaskBtn").getChildByName("Tip").active || (this.node.getChildByName("BtnPanel").getChildByName("TaskBtn").getChildByName("Tip").active = true, this.node.getChildByName("BtnPanel").getChildByName("TaskBtn").getComponent(cc.Animation).play()));
        }
      }
      if (this.node.getChildByName("BtnPanel").getChildByName("TaskBtn").getChildByName("Tip").active) {
        this.node.getChildByName("BtnPanel").getChildByName("TaskBtn").getChildByName("Tip").active = false;
        this.node.getChildByName("BtnPanel").getChildByName("TaskBtn").getComponent(cc.Animation).stop();
        this.node.getChildByName("BtnPanel").getChildByName("TaskBtn").angle = 0;
        this.node.getChildByName("BtnPanel").getChildByName("TaskBtn").scale = 1;
      }
    }
  }, {
    key: "refreshSignBtn",
    value: function refreshSignBtn() {
      if (0 == $2UserDataManager.default.instance.signTimes) {
        if (!this.node.getChildByName("BtnPanel").getChildByName("SignBtn").getChildByName("Tip").active) {
          this.node.getChildByName("BtnPanel").getChildByName("SignBtn").getChildByName("Tip").active = true, this.node.getChildByName("BtnPanel").getChildByName("SignBtn").getComponent(cc.Animation).play();
        }
      } else if (this.node.getChildByName("BtnPanel").getChildByName("SignBtn").getChildByName("Tip").active) {
        this.node.getChildByName("BtnPanel").getChildByName("SignBtn").getChildByName("Tip").active = false, this.node.getChildByName("BtnPanel").getChildByName("SignBtn").getComponent(cc.Animation).stop(), this.node.getChildByName("BtnPanel").getChildByName("SignBtn").angle = 0, this.node.getChildByName("BtnPanel").getChildByName("SignBtn").scale = 1;
      }
    }
  }, {
    key: "refreshOnlineBtn",
    value: function refreshOnlineBtn() {
      if ($2UserDataManager.default.instance.onlineTime >= 300 && $2UserDataManager.default.instance.onlineNum <= 2) {
        if (!this.node.getChildByName("BtnPanel").getChildByName("onlineBtn").getChildByName("Tip").active) {
          this.node.getChildByName("BtnPanel").getChildByName("onlineBtn").getChildByName("Tip").active = true, this.node.getChildByName("BtnPanel").getChildByName("onlineBtn").getComponent(cc.Animation).play();
        }
      } else if (this.node.getChildByName("BtnPanel").getChildByName("onlineBtn").getChildByName("Tip").active) {
        this.node.getChildByName("BtnPanel").getChildByName("onlineBtn").getChildByName("Tip").active = false, this.node.getChildByName("BtnPanel").getChildByName("onlineBtn").getComponent(cc.Animation).stop(), this.node.getChildByName("BtnPanel").getChildByName("onlineBtn").angle = 0, this.node.getChildByName("BtnPanel").getChildByName("onlineBtn").scale = 1;
      }
    }
  }, {
    key: "initPlatform",
    value: function initPlatform() {}
  }, {
    key: "onClickTestBtn",
    value: function onClickTestBtn() {}
  }, {
    key: "guideToast",
    value: function guideToast(e) {
      this.guidePanel.active = true;
      this.guidePanel.getComponentInChildren(cc.Label).string = e;
    }
  }, {
    key: "refreshUpgradeBtn",
    value: function refreshUpgradeBtn() {
      for (var _e54 = 0; _e54 < $2DataManager.default.instance.plantArray.length; _e54++) {
        if (!$2UserDataManager.default.instance.plantLock.includes($2DataManager.default.instance.plantArray[_e54]) && $2UserDataManager.default.instance.getPlantChip($2DataManager.default.instance.plantArray[_e54]) >= 20) {
          this.node.getChildByName("BtnPanel").getChildByName("UpgradeBtn").getChildByName("Tip").active = true;
          return void this.node.getChildByName("BtnPanel").getChildByName("UpgradeBtn").getComponent(cc.Animation).play();
        }
        if ($2UserDataManager.default.instance.plantLock.includes($2DataManager.default.instance.plantArray[_e54]) && $2UserDataManager.default.instance.getPlantChip($2DataManager.default.instance.plantArray[_e54]) >= $2PlantMgr.default.instance().getPlant($2DataManager.default.instance.plantArray[_e54]).costChip[$2UserDataManager.default.instance.getPlantLevel($2DataManager.default.instance.plantArray[_e54]) - 1][1] && $2UserDataManager.default.instance.gold >= $2PlantMgr.default.instance().getPlant($2DataManager.default.instance.plantArray[_e54]).costGold[$2UserDataManager.default.instance.getPlantLevel($2DataManager.default.instance.plantArray[_e54]) - 1][1]) {
          this.node.getChildByName("BtnPanel").getChildByName("UpgradeBtn").getChildByName("Tip").active = true;
          return void this.node.getChildByName("BtnPanel").getChildByName("UpgradeBtn").getComponent(cc.Animation).play();
        }
      }
      this.node.getChildByName("BtnPanel").getChildByName("UpgradeBtn").getChildByName("Tip").active = false;
      this.node.getChildByName("BtnPanel").getChildByName("UpgradeBtn").getComponent(cc.Animation).stop();
      this.node.getChildByName("BtnPanel").getChildByName("UpgradeBtn").angle = 0;
      this.node.getChildByName("BtnPanel").getChildByName("UpgradeBtn").scale = 1;
    }
  }, {
    key: "bg2Move",
    value: function bg2Move() {
      this.bg2.x = (this.bg1.x + 667.5) / 2 - 667.5;
      this.bg3.x = (this.bg1.x + 667.5) / 4 - 667.5;
    }
  }, {
    key: "initBg",
    value: function initBg() {
      if ($2UserDataManager.default.instance.level > 2) {
        this.bg1.x = -667.5 - this.btnPanel.children[$2UserDataManager.default.instance.level - 1].x;
        this.bg2.x = (this.bg1.x + 667.5) / 2 - 667.5;
        this.bg3.x = (this.bg1.x + 667.5) / 4 - 667.5;
      }
    }
  }, {
    key: "initBtnPanel",
    value: function initBtnPanel() {
      for (var _e55 = 0; _e55 < this.btnPanel.childrenCount; _e55++) {
        if (_e55 < $2UserDataManager.default.instance.level - 1) {
          this.btnPanel.children[_e55].getChildByName("Bg").getComponent(cc.Sprite).spriteFrame = $2BundleManager.default.instance.getBundleRes("BundleTexture", "MenuUI/z002", cc.SpriteFrame);
          this.btnPanel.children[_e55].getChildByName("Star").getComponent(cc.Sprite).spriteFrame = $2BundleManager.default.instance.getBundleRes("BundleTexture", "MenuUI/z007", cc.SpriteFrame);
        } else if (_e55 != $2UserDataManager.default.instance.level - 1 || $2DataManager.default.instance.focus) {
          this.btnPanel.children[_e55].getChildByName("Bg").getComponent(cc.Sprite).spriteFrame = $2BundleManager.default.instance.getBundleRes("BundleTexture", "MenuUI/z003", cc.SpriteFrame);
          this.btnPanel.children[_e55].getChildByName("Star").getComponent(cc.Sprite).spriteFrame = $2BundleManager.default.instance.getBundleRes("BundleTexture", "MenuUI/z008", cc.SpriteFrame);
        } else {
          this.btnPanel.children[_e55].getChildByName("Bg").getComponent(cc.Sprite).spriteFrame = $2BundleManager.default.instance.getBundleRes("BundleTexture", "MenuUI/z002", cc.SpriteFrame);
          var _t31 = cc.instantiate($2BundleManager.default.instance.getBundleRes("Prefab", "Object/BtnEffect"));
          this.btnPanel.children[_e55].addChild(_t31);
        }
        var _t32 = cc.instantiate($2BundleManager.default.instance.getBundleRes("Prefab", "Object/LevelNum"));
        this.btnPanel.children[_e55].addChild(_t32);
        _t32.getComponent(cc.Label).string = _e55 + 1 + "";
      }
    }
  }, {
    key: "playAnimation",
    value: function playAnimation() {
      var _this113 = this;
      var _loop3 = function _loop3(_e56) {
        cc.tween(_this113.effectPanel.children[_e56].children[0]).to(2, {
          x: _this113.effectPanel.children[_e56].width
        }).call(function () {
          _this113.effectPanel.children[_e56].children[0].x = 0;
        }).union().repeatForever().start();
        cc.tween(_this113.effectPanel.children[_e56].children[1]).to(5, {
          x: _this113.effectPanel.children[_e56].width
        }).call(function () {
          _this113.effectPanel.children[_e56].children[1].x = 0;
        }).union().repeatForever().start();
      };
      for (var _e56 = 0; _e56 < this.effectPanel.childrenCount; _e56++) {
        _loop3(_e56);
      }
    }
  }, {
    key: "onClickTaskBtn",
    value: function onClickTaskBtn() {
      if ($2DataManager.default.instance.bossGuide) {
        $2DataManager.default.instance.bossGuide = false;
        $2UserDataManager.default.instance.bossGuide = true;
        this.hideGuide();
      }
      $2UIManager.default.instance.openUI("TaskUI", 20);
      $2pvzChannel.pvzChannel.instance().closeNative("nativeIcon");
      this.node.opacity = 0;
    }
  }, {
    key: "onClickMultPlants",
    value: function onClickMultPlants() {
      if ($2DataManager.default.instance.multi_plants) {
        $2DataManager.default.instance.multi_plants = false;
        $2UIManager.default.instance.showToast("种植多个植物已关闭");
      } else {
        $2DataManager.default.instance.multi_plants = true;
        $2UIManager.default.instance.showToast("种植多个植物已启用");
      }
    }
  }, {
    key: "onClickNoCD",
    value: function onClickNoCD() {
      if ($2DataManager.default.instance.noCD) {
        $2DataManager.default.instance.noCD = false;
        $2UIManager.default.instance.showToast("无CD开局1W阳光已关闭");
      } else {
        $2DataManager.default.instance.noCD = true;
        $2UIManager.default.instance.showToast("无CD开局1W阳光已启用");
      }
    }
  }, {
    key: "onClickStartBtn",
    value: function onClickStartBtn(e) {
      Adv_skd.default.instance.hideAllAdv();
      if (!($2UserDataManager.default.instance.level < parseInt(e.currentTarget.name))) {
        if ($2DataManager.default.instance.bossGuide) {
          $2DataManager.default.instance.bossGuide = false, $2UserDataManager.default.instance.bossGuide = true;
        }
        $2DataManager.default.instance.level = parseInt(e.currentTarget.name);
        20 == $2DataManager.default.instance.level && ($2DataManager.default.instance.bossLevel = 2);
        $2UIManager.default.instance.openUI("MainUI");
        $2UIManager.default.instance.closeUI("MenuUI");
        $2pvzChannel.pvzChannel.instance().closeNative("nativeIcon");
      }
    }
  }, {
    key: "onClickShopBtn",
    value: function onClickShopBtn() {
      if ($2DataManager.default.instance.bossGuide) {
        $2DataManager.default.instance.bossGuide = false;
        $2UserDataManager.default.instance.bossGuide = true;
        this.guidePanel.active = false;
        this.node.getChildByName("BtnPanel").getChildByName("BossBtn").getChildByName("GuideFinger") && this.node.getChildByName("BtnPanel").getChildByName("BossBtn").getChildByName("GuideFinger").destroy();
      }
      $2UIManager.default.instance.openUI("ShopUI", 20);
      $2pvzChannel.pvzChannel.instance().closeNative("nativeIcon");
      this.node.opacity = 0;
    }
  }, {
    key: "onClickDrawBtn",
    value: function onClickDrawBtn() {
      if ($2DataManager.default.instance.bossGuide) {
        $2DataManager.default.instance.bossGuide = false;
        $2UserDataManager.default.instance.bossGuide = true;
        this.hideGuide();
      }
      $2UIManager.default.instance.openUI("DrawUI", 20);
      $2pvzChannel.pvzChannel.instance().closeNative("nativeIcon");
      this.node.opacity = 0;
    }
  }, {
    key: "onClickSignBtn",
    value: function onClickSignBtn() {
      if ($2DataManager.default.instance.bossGuide) {
        $2DataManager.default.instance.bossGuide = false;
        $2UserDataManager.default.instance.bossGuide = true;
        this.hideGuide();
      }
      $2UIManager.default.instance.openUI("SignUI", 20);
      $2pvzChannel.pvzChannel.instance().closeNative("nativeIcon");
      this.node.opacity = 0;
    }
  }, {
    key: "onClickUpgradeBtn",
    value: function onClickUpgradeBtn() {
      if ($2DataManager.default.instance.bossGuide) {
        $2DataManager.default.instance.bossGuide = false;
        $2UserDataManager.default.instance.bossGuide = true;
        this.hideGuide();
      }
      $2UIManager.default.instance.openUI("UpgradeUI", 20);
      $2pvzChannel.pvzChannel.instance().closeNative("nativeIcon");
      this.node.opacity = 0;
    }
  }, {
    key: "hideGuide",
    value: function hideGuide() {
      this.guidePanel.active = false;
      this.node.getChildByName("BtnPanel").getChildByName("BossBtn").getChildByName("GuideFinger") && this.node.getChildByName("BtnPanel").getChildByName("BossBtn").getChildByName("GuideFinger").destroy();
    }
  }, {
    key: "onClickBossBtn",
    value: function onClickBossBtn() {
      if ($2DataManager.default.instance.bossGuide) {
        $2DataManager.default.instance.bossGuide = false;
        $2UserDataManager.default.instance.bossGuide = true;
        this.hideGuide();
      }
      $2TaSdk.default.instance.postEvent("System", {
        system: "Boss挑战"
      });
      $2Hts.default.instance.eventReport("点击挑战BOSS按钮");
      $2UIManager.default.instance.openUI("BossSelectUI");
      $2pvzChannel.pvzChannel.instance().closeNative("nativeIcon");
    }
  }, {
    key: "onClickOnlineBtn",
    value: function onClickOnlineBtn() {
      if ($2DataManager.default.instance.bossGuide) {
        $2DataManager.default.instance.bossGuide = false;
        $2UserDataManager.default.instance.bossGuide = true;
        this.hideGuide();
      }
      $2TaSdk.default.instance.postEvent("System", {
        system: "在线奖励"
      });
      $2UIManager.default.instance.openUI("OnlineRewardUI");
      $2pvzChannel.pvzChannel.instance().closeNative("nativeIcon");
      this.node.opacity = 0;
    }
  }, {
    key: "onClickGetPlant",
    value: function onClickGetPlant() {
      for (var _e57 = 1; _e57 <= $2DataManager.default.instance.plantArray.length; _e57++) {
        $2UserDataManager.default.instance.getPlant(_e57);
        $2DataManager.default.instance.newPlant.includes(_e57) || $2DataManager.default.instance.newPlant.push(_e57);
      }
    }
  }, {
    key: "onClickMaxLevel",
    value: function onClickMaxLevel() {
      for (var _e58 = 1; _e58 <= $2DataManager.default.instance.plantArray.length; _e58++) {
        $2UserDataManager.default.instance.getPlant(_e58);
        $2UserDataManager.default.instance.setPlantLevel(_e58, 10);
        $2DataManager.default.instance.newPlant.includes(_e58) || $2DataManager.default.instance.newPlant.push(_e58);
      }
      $2UIManager.default.instance.showToast("植物已全部满级");
    }
  }, {
    key: "onClickADdGold",
    value: function onClickADdGold() {
      $2UserDataManager.default.instance.gold += 5e3;
      $2UIManager.default.instance.showToast("金币加5000");
    }
  }, {
    key: "onClickLockLevel",
    value: function onClickLockLevel() {
      $2UserDataManager.default.instance.level = 20;
      this.initBtnPanel();
      $2UIManager.default.instance.showToast("关卡已解锁");
    }
  }, {
    key: "onClickAddDiamond",
    value: function onClickAddDiamond() {
      $2UserDataManager.default.instance.diamond += 5e3;
      $2UIManager.default.instance.showToast("钻石加5000");
    }
  }, {
    key: "onClearData",
    value: function onClearData() {
      $2UIManager.default.instance.showToast("数据已清除，重新进游戏");
      cc.sys.localStorage.clear();
      cc.game.end();
    }
  }, {
    key: "update",
    value: function update(e) {
      if (this.node.getChildByName("BgPanel").getComponent(cc.ScrollView)._autoScrolling) {
        this.bg2.x = (this.bg1.x + 667.5) / 2 - 667.5;
        this.bg3.x = (this.bg1.x + 667.5) / 4 - 667.5;
      }
    }
  }]);
  return b;
}(cc.Component);
cc__decorate([ccp_property(cc.Node)], def_MenuUI.prototype, "moreGame", undefined);
cc__decorate([ccp_property(cc.Node)], def_MenuUI.prototype, "bt_jsdx_buy", undefined);
def_MenuUI = cc__decorate([ccp_ccclass], def_MenuUI);
exports.default = def_MenuUI;